package demo6;

public class Demo2 {
    public static void main(String[] args) {
        Singleton s1 = Singleton.getInstance();
        Singleton s2 = Singleton.getInstance();
        System.out.println("s1="+s1);
        System.out.println("s2="+s2);//因为getInstance()方法返回的总是同一个对象

        Student student1 = Student.getInstance();
        Student student2 = Student.getInstance();
        System.out.println("student1="+s1);
        System.out.println("student2="+s2);
    }
}
